package cn.kgc.novel.exception;

import cn.kgc.novel.common.Result;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class BasicExceptionHandler {
    @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
    public Result handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException exception){
        return Result.error(405,"请求方式不一致");
    }
    @ExceptionHandler(UserNotExitsException.class)
    public Result userNotExitsException(UserNotExitsException exception){
        return Result.error(exception.getErrorCodeEnum());
    }

}
